package com.zmkj.cn.comm.baseenum;

import com.google.common.collect.Maps;
import lombok.Getter;

import java.util.Map;

/**
 *
 * @author 伍绍宇 Coy
 * @date 2021年3月10日 18:07:29
 */
@Getter
public enum SynchroInitDataEnum {
    /**
     * 字典
     */
    DIC("dic", "1.0.0"),
    /**
     * 部门
     */
    UNIT("unit", "1.0.0"),
    /**
     * 用户
     */
    USER("user", "1.0.0");


    /**
     * value
     */
    private final String value;
    /**
     * 初始版本号
     */
    private final String startCode;

    SynchroInitDataEnum(String value, String startCode) {
        this.value = value;
        this.startCode = startCode;
    }

    public String getValue() {
        return value;
    }

    public static SynchroInitDataEnum trans(String value) {
        for (SynchroInitDataEnum obj : SynchroInitDataEnum.values()) {
            if (obj.value .equals(value) ) {
                return obj;
            }
        }
        return null;
    }

    public static Map<String, String> toMap() {
        Map<String, String> map = Maps.newHashMap();
        for (SynchroInitDataEnum obj : SynchroInitDataEnum.values()) {
            map.put(obj.getValue(), obj.getStartCode());
        }
        return map;
    }
}
